home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_nub_stonedoor.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  186 lines

  1. # Jones 3D Cog Script
  2. #
  3. # nub_StoneDoor.cog
  4. #
  5. # [RKD] [TL] [RT] [GGJ]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9. symbols
  10.  
  11. message        startup
  12. message        activated    
  13. message        arrived        
  14. message        entered
  15. message        crossed
  16.  
  17. thing        door0
  18. thing        lever
  19. thing        player                            local
  20. thing        indy                            nolink
  21. thing        camera
  22. thing        camera2
  23. thing        newCam
  24. thing        newTarg
  25. thing        treasure
  26. thing        windspot
  27.  
  28. keyframe    in_pull=in_pull_lever_down.key    local
  29. keyframe    lever_down=gen_lever.key        local
  30. sound        startdoor
  31. sound        movedoor
  32. sound        stopdoor
  33. sound        leversound
  34. sound        leversound2
  35. sound        lockedwav
  36. sound        ahawav=inxj147.wav                local
  37. sound        openwav
  38. sound        windSnd=gen_wind08.wav            local        #wind10.wav            local
  39.  
  40. sector        entersector
  41.  
  42. int            open=0                            local
  43. int            move0channel                    local
  44. int            move1channel                    local
  45. int            begun=0                            local
  46. int            revealdone=0                    local
  47. int            lockeddone=0                    local
  48.  
  49. flex        moveSpeed=1.0
  50. vector        v_targetpos                        local
  51. vector        v_pull                            local
  52.  
  53. end
  54.  
  55. # ========================================================================================
  56. code
  57.  
  58. startup:
  59.  
  60. Sleep(0.01);
  61. v_pull=GetThingLVec(indy);
  62. player = GetLocalPlayerThing();
  63. SetThingLight(treasure, VectorSet(1.0, 1.0, 0.75), 0.01, 0.5);
  64. PlaySoundThing(windSnd, windSpot, 1.0, 20.0, 25.0, 0x1);
  65.  
  66. return;
  67.  
  68. #........................................................................................
  69. activated:
  70.  
  71. if (begun == 1)    return;
  72. if (lockeddone == 1) return;
  73.  
  74. if (GetSenderRef() == door0)
  75. {
  76.     DeselectWeaponWait(player);
  77.     lockeddone = 1;
  78.     PlayMode(player, 60, 0);
  79.     PlayVoice(player, lockedwav, 1.0, 1);
  80. }
  81. lockeddone = 0;
  82.  
  83. if (GetSenderRef() == lever)
  84. {
  85.     begun = 1;
  86.     MakeMeStop();
  87.     DeselectWeaponWait(player);
  88.     StartCutscene(1);
  89.     SetThingFlags(player, 0x80000);
  90.     
  91.     SetCameraFocus(2, newCam);
  92.     SetCameraSecondaryFocus(2, newTarg);
  93.     SetCurrentCamera(2);
  94.     SetCameraFOV(90, 0, 0.0);
  95.     
  96.     CopyPlayerHolsters(player, indy);
  97.     ClearThingFlags(indy, 0x80000);
  98.     PlayKey(lever, lever_down, 4, 0x12, 0);
  99.     PlayKey(indy, in_pull, 4, 0x12, 0);
  100.     Sleep(1.2);   
  101.     PlaySoundLocal(leversound, 1.0, 0, 0x0000, 0);
  102.     Sleep(1.4);
  103.     PlaySoundLocal(leversound2, 1.0, 0, 0x0000, 0);
  104.     Sleep(0.3);
  105.     if (open == 0)
  106.     {
  107.         PlaySoundLocal(startdoor, 1.0, 0, 0x0000, 0);
  108.         move0channel = PlaySoundLocal(movedoor, 1.0, 0, 0x0001, 0);
  109.  
  110.         MoveToFrame(door0, 1, moveSpeed);
  111.  
  112.         Sleep(1.0);
  113.         AISetLookThing(indy, camera2);
  114.         PlayVoice(indy, openwav, 1.0, 0);
  115.         Sleep(1.0);
  116.         
  117.         CopyOrientAndPos(indy, player);
  118.         SetThingFlags(indy, 0x80000);
  119.         SetThingLook(indy, v_pull);
  120.         ClearThingFlags(player, 0x80000);
  121.         ClearActorFlags(player, 0x200000);
  122.         # revert cam
  123.         v_targetpos = VectorAdd(VectorTransformToOrient(Player, '-0.05 0.2 0.0'), GetThingPos(player));    
  124.         SetCameraPosition(1, v_targetpos);
  125.         
  126.         SetCurrentCamera(1);
  127.         SetCameraFOV(90, 0, 0.0);
  128.         EndCutscene();
  129.         begun = 0;
  130.     }
  131.     else
  132.     {
  133.         PlaySoundLocal(startdoor, 1.0, 0, 0x0000, 0);
  134.         move1channel = PlaySoundLocal(movedoor, 1.0, 0, 0x0001, 0);
  135.  
  136.         MoveToFrame(door0, 0, moveSpeed);
  137.  
  138.         Sleep(2.5);
  139.         
  140.         # revert cam
  141.         v_targetpos = VectorAdd(VectorTransformToOrient(Player, '0.2 -0.05 0.0'), GetThingPos(player));    
  142.         SetCameraPosition(1, v_targetpos);
  143.         SetCurrentCamera(1);
  144.         
  145.         SetCameraFOV(90, 0, 0.0);
  146.         SetThingFlags(indy, 0x80000);
  147.         SetThingLook(indy, v_pull);
  148.         ClearThingFlags(player, 0x80000);
  149.         ClearActorFlags(player, 0x200000);
  150.         EndCutscene();
  151.         begun = 0;
  152.     }
  153. }
  154.  
  155. return;
  156.  
  157. # ........................................................................................
  158. arrived:
  159.  
  160. if (GetSenderRef() != door0) return;
  161.  
  162. StopSound(move0channel, 0.0);
  163. StopSound(move1channel, 0.0);
  164. PlaySoundLocal(stopdoor, 1.0, 0, 0x0000, 0);
  165. open = 1 - open;
  166.  
  167. return;
  168.  
  169. # ........................................................................................
  170.  
  171. entered:
  172.  
  173. if (revealdone == 1) return;
  174.  
  175. if (GetSenderRef() == entersector)
  176. {
  177.     PlayVoice(player, ahawav, 1.0, 0);
  178.     revealdone = 1;
  179. }
  180.  
  181. return;
  182.  
  183. # ........................................................................................
  184. end
  185.  
  186.